<?php

namespace api\controller;

// +----------------------------------------------------------------------
// | 回款 服务控制层
// +----------------------------------------------------------------------

use common\controller\VerifyController;
use common\service\FinanceService;
use think\Request;

class ReceivableController extends VerifyController
{
    protected $financeService;

    /**
     * ContractTemplateController constructor.
     */
    public function __construct()
    {
        parent::__construct();
        $this->financeService = new FinanceService();
    }

    /**
     * 查询回款数据
     * @param Request $request
     * @return \think\Response
     * @throws \Exception
     */
    public function select(Request $request)
    {
        $param = $request->param();
        $resData = $this->financeService->selectReceivableData($param['param'], $request->getTenantId());
        return json(success_response('', $resData));
    }


    /**
     * 确认收款
     * @param Request $request
     * @return \think\Response
     * @throws \Throwable
     * @throws \think\Exception
     */
    public function ensureSettlement(Request $request)
    {
        $param = $request->param();
        $resData = $this->financeService->ensureSettlement($param['param']);
        return json(success_response('', $resData));
    }
}
